+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
+2001-06-04 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkspinbutton.c: Get rid of stupid g_return_if_fail on
+ digits greater than 6. If there actually are limits (which there
+ likely aren't), should clamp to them not warn.
+ (gtk_spin_button_new_with_range): don't take log of 0
+ (gtk_spin_button_size_request): use digits to compute size
+ request, rather than step increment.
+
+ * tests/testgtk.c (create_spins): test larger values of digits
+
+ * gtk/gtkfontsel.c (gtk_font_selection_init): scroll to selected
+ font on map not expose, so we don't get weirdness during scrolling
+
2001-06-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkclist.c (vadjustment_value_changed): Apply fix from
GdkEventButton *bevent,
gpointer data);
-static void gtk_font_selection_expose_list (GtkWidget *w,
- GdkEventExpose *event,
+static void gtk_font_selection_scroll_on_map (GtkWidget *w,
gpointer data);
static void gtk_font_selection_preview_changed (GtkWidget *entry,
fontsel);
GTK_WIDGET_SET_FLAGS (fontsel->font_clist, GTK_CAN_FOCUS);
- gtk_signal_connect_after (GTK_OBJECT (fontsel->font_clist), "expose_event",
- GTK_SIGNAL_FUNC(gtk_font_selection_expose_list),
+ gtk_signal_connect_after (GTK_OBJECT (fontsel->font_clist), "map",
+ GTK_SIGNAL_FUNC(gtk_font_selection_scroll_on_map),
fontsel);
gtk_font_selection_show_available_styles (fontsel);
g_object_notify (G_OBJECT (fontsel), "preview_text");
}
-/* This is called when the clist is exposed. Here we scroll to the current
+/* This is called when the clist is mapped. Here we scroll to the current
font if necessary. */
static void
-gtk_font_selection_expose_list (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
+gtk_font_selection_scroll_on_map (GtkWidget *widget,
+ gpointer data)
{
GtkFontSelection *fontsel;
GList *selection;
}
static int
-compute_double_length (double val, double step)
+compute_double_length (double val, int digits)
{
- int a, b;
+ int a;
int extra;
a = 1;
if (fabs (val) > 1.0)
- a = floor (log10 (fabs (val))) + 1;
-
- b = 0;
- if (fabs (step) < 1.0 && step != 0.0)
- b = ceil (-log10 (fabs (step)));
+ a = floor (log10 (fabs (val))) + 1;
extra = 0;
/* The dot: */
- if (b > 0)
+ if (digits > 0)
extra++;
/* The sign: */
if (val < 0)
extra++;
- return a + b + extra;
+ return a + digits + extra;
}
static void
width = MIN_SPIN_BUTTON_WIDTH;
string_len = compute_double_length (spin_button->adjustment->upper,
- spin_button->adjustment->step_increment);
+ spin_button->digits);
w = MIN (string_len, 10) * PANGO_PIXELS (metrics.approximate_digit_width);
width = MAX (width, w);
string_len = compute_double_length (spin_button->adjustment->lower,
{
g_return_if_fail (spin_button != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- g_return_if_fail (digits < 6);
if (adjustment)
gtk_spin_button_set_adjustment (spin_button, adjustment);
if (adjustment)
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
- g_return_val_if_fail (digits < 6, NULL);
spin = gtk_type_new (GTK_TYPE_SPIN_BUTTON);
adj = gtk_adjustment_new (min, min, max, step, 10 * step, step);
- if (fabs (step) >= 1.0)
+ if (fabs (step) >= 1.0 || step == 0.0)
digits = 0;
else {
digits = abs ((gint) floor (log10 (fabs (step))));
guint digits)
{
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- g_return_if_fail (digits < 6);
if (spin_button->digits != digits)
{
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
- adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 5, 1, 1, 0);
+ adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 15, 1, 1, 0);
spinner2 = gtk_spin_button_new (adj, 0.0, 0);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (change_digits),